﻿using System.Data;
using ZhangBY.Entity;

namespace ZhangBY.Data.DataProvider
{
    public  class RolesOrPermissions
    {
        /// <summary>
        /// 根據用戶名和模塊代號取得用戶模塊權限
        /// </summary>
        /// <param name="Account">用戶名</param>
        /// <param name="ModuleCode">模塊代號</param>
        /// <returns></returns>
        public static  DataSet GetCompanyModulePermissions(string Account, int indexName)
        {
            return DbSupplier.GetInstance.GetCompanyModulePermissions(Account,indexName);
        }
        /// <summary>
        /// 根據用戶名和模塊名稱取得用戶模塊權限
        /// </summary>
        /// <param name="Account">用戶名</param>
        /// <param name="ModuleName">模塊名</param>
        /// <returns></returns>
        public static  DataSet GetCompanyModulePermissions(string Account, string ModuleName)
        {
            return DbSupplier.GetInstance.GetCompanyModulePermissions(Account,ModuleName);
        }
        /// <summary>
        /// 根據帳號取得所有模塊角色權限
        /// </summary>
        /// <param name="Account">帳號</param>
        /// <returns></returns>
        public static  DataSet GetCompanyAllModulePermissions(string Account)
        {
            return DbSupplier.GetInstance.GetCompanyAllModulePermissions(Account);
        }
        /// <summary>
        /// 根據用戶名取得該用戶隸屬角色
        /// </summary>
        /// <param name="Account"></param>
        /// <returns></returns>
        public static  DataSet GetCompanyAllUserRoles(string Account)
        {

            return DbSupplier.GetInstance.GetCompanyAllUserRoles(Account);
        }
        /// <summary>
        /// 根據用戶名取得該用戶擁有操作模塊資源
        /// </summary>
        /// <param name="Account"></param>
        /// <returns></returns>
        public static  DataSet GetCompanyAllUserModule(string Account)
        {
            return DbSupplier.GetInstance.GetCompanyAllUserModule(Account);
        }
        /// <summary>
        /// 取得所有模塊資源
        /// </summary>
        /// <returns></returns>
        public static  DataSet GetCompanyAllModule()
        {
            return DbSupplier.GetInstance.GetCompanyAllModule();
        }
        /// <summary>
        /// 創建一個新角色
        /// </summary>
        /// <param name="RolesName">角色名</param>
        /// <returns></returns>
        public static  int AddNewCompanyRoles(string RolesName)
        {
            return DbSupplier.GetInstance.AddNewCompanyRoles(RolesName);
        }
        /// <summary>
        /// 創建一個新角色并返回角色ID
        /// </summary>
        /// <param name="RolesName">角色名</param>
        /// <returns></returns>
        public static  object AddNewCompanyRolesReturnId(string RolesName)
        {
            return DbSupplier.GetInstance.AddNewCompanyRolesReturnId(RolesName);
        }
        /// <summary>
        /// 根據角色名刪除角色
        /// </summary>
        /// <param name="RolesName"></param>
        /// <returns></returns>
        public static  int DeleteCompanyRoles(string RolesName)
        {
            return DbSupplier.GetInstance.DeleteCompanyRoles(RolesName);
        }
        /// <summary>
        /// 根據角色主鍵ID刪除角色
        /// </summary>
        /// <param name="RolesId"></param>
        /// <returns></returns>
        public static  int DeleteCompanyRoles(int RolesId)
        {
            return DbSupplier.GetInstance.DeleteCompanyRoles(RolesId);
        }
        /// <summary>
        /// 根據ROLES表組件ID更改角色名
        /// </summary>
        /// <param name="RolesId"></param>
        /// <param name="RolesName"></param>
        /// <returns></returns>
        public static  int UpdateCompanyRolesName(int RolesId, string RolesName)
        {
            return DbSupplier.GetInstance.UpdateCompanyRolesName(RolesId,RolesName);
        }
        /// <summary>
        /// 添加（分配）用戶角色
        /// </summary>
        /// <param name="UserId"></param>
        /// <param name="RolesId"></param>
        /// <returns></returns>
        public static  int AddNewCompanyUserRoles(int UserId, int RolesId)
        {
            return DbSupplier.GetInstance.AddNewCompanyUserRoles(UserId,RolesId);
        }
        /// <summary>
        /// 添加（分配）用戶角色
        /// </summary>
        /// <param name="UserId"></param>
        /// <param name="RolesId"></param>
        /// <returns></returns>
        public static  int AddNewCompanyUserRoles(string UserId, string RolesId)
        {
            return DbSupplier.GetInstance.AddNewCompanyUserRoles(UserId,RolesId);
        }
        /// <summary>
        /// 根據UserRoles主鍵ID刪除用戶角色
        /// </summary>
        /// <param name="UserRolesId"></param>
        /// <returns></returns>
        public static  int DeleteCompanyUserRoles(int UserRolesId)
        {
            return DbSupplier.GetInstance.DeleteCompanyUserRoles(UserRolesId);
        }
        /// <summary>
        /// 刪除用戶角色
        /// </summary>
        /// <param name="UserId"></param>
        /// <param name="RolesId"></param>
        /// <returns></returns>
        public static  int DeleteCompanyUserRoles(int UserId, int RolesId)
        {
            return DbSupplier.GetInstance.DeleteCompanyUserRoles(UserId,RolesId);
        }
        /// <summary>
        /// 根據指定用戶ID刪除用戶角色
        /// </summary>
        /// <param name="UserId"></param>
        /// <param name="RolesId"></param>
        /// <returns></returns>
        public static  int DeleteCompanyUserRoles(string UserId)
        {
            return DbSupplier.GetInstance.DeleteCompanyUserRoles(UserId);
        }
        /// <summary>
        /// 根據用戶名取得用戶主鍵ID
        /// </summary>
        /// <param name="UserName"></param>
        /// <returns></returns>
        public static  object GetCompanyUserID(string UserName)
        {
            return DbSupplier.GetInstance.GetCompanyUserID(UserName);
        }
        /// <summary>
        /// 根據角色名取得角色主鍵ID
        /// </summary>
        /// <param name="RolesName"></param>
        /// <returns></returns>
        public static  object GetCompanyRolesID(string RolesName)
        {
            return DbSupplier.GetInstance.GetCompanyRolesID(RolesName);
        }
        /// <summary>
        /// 取得角色表所有信息
        /// </summary>
        /// <returns></returns>
        public static  DataSet GetCompanyRolesInfo()
        {
            return DbSupplier.GetInstance.GetCompanyRolesInfo();
        }
        /// <summary>
        /// 取得角色模塊資源
        /// </summary>
        /// <param name="rolesid"></param>
        /// <returns></returns>
        public static  DataSet GetCompanyRolesModule(string rolesid)
        {
            return DbSupplier.GetInstance.GetCompanyRolesModule(rolesid);
        }
        /// <summary>
        /// 取得權限類表全部記錄信息
        /// </summary>
        /// <returns></returns>
        public static  DataSet GetCompanyPermissionsInfo()
        {
            return DbSupplier.GetInstance.GetCompanyPermissionsInfo();
        }
        /// <summary>
        /// 添加一組操作權限
        /// </summary>
        /// <param name="All"></param>
        /// <param name="Read"></param>
        /// <param name="Edit"></param>
        /// <param name="Delete"></param>
        /// <param name="Add"></param>
        /// <returns></returns>
        public static  int AddNewCompanyPermissions(PermissionsInfo Per)
        {
            return DbSupplier.GetInstance.AddNewCompanyPermissions(Per);
        }
        /// <summary>
        /// 根據權限主鍵ID刪除權限組
        /// </summary>
        /// <param name="PermissionsId"></param>
        /// <returns></returns>
        public static  int DeleteCompanyPermissions(int PermissionsId)
        {
            return DbSupplier.GetInstance.DeleteCompanyPermissions(PermissionsId);
        }
        /// <summary>
        /// 添加（分配）角色權限
        /// </summary>
        /// <param name="RolesId"></param>
        /// <param name="PermissionsId"></param>
        /// <returns></returns>
        public static  int AddNewCompanyRolesPermissions(int RolesId, int PermissionsId)
        {
            return DbSupplier.GetInstance.AddNewCompanyRolesPermissions(RolesId,PermissionsId);
        }
        /// <summary>
        /// 刪除角色權限
        /// </summary>
        /// <param name="RolesId"></param>
        /// <param name="PermissionsId"></param>
        /// <returns></returns>
        public static  int DeleteCompanyRolesPermissions(int RolesId, int PermissionsId)
        {
            return DbSupplier.GetInstance.DeleteCompanyRolesPermissions(RolesId,PermissionsId);
        }
        /// <summary>
        /// 根據RolesPermissions主鍵ID刪除角色權限
        /// </summary>
        /// <param name="RolesPermissionsId"></param>
        /// <returns></returns>
        public static  int DeleteCompanyRolesPermissions(int RolesPermissionsId)
        {
            return DbSupplier.GetInstance.DeleteCompanyRolesPermissions(RolesPermissionsId);
        }
        /// <summary>
        /// 添加新操作模塊
        /// </summary>
        /// <param name="MInfo"></param>
        /// <returns></returns>
        public static  int AddNewCompanyModule(ModuleInfo MInfo)
        {
            return DbSupplier.GetInstance.AddNewCompanyModule(MInfo);
        }
        /// <summary>
        /// 根據模塊ID更新模塊名
        /// </summary>
        /// <param name="MInfo"></param>
        /// <returns></returns>
        public static  int UpdateCompanyModuleName(ModuleInfo MInfo)
        {
            return DbSupplier.GetInstance.UpdateCompanyModuleName(MInfo);
        }
        /// <summary>
        /// 根據模塊ID刪除模塊
        /// </summary>
        /// <param name="MInfo"></param>
        /// <returns></returns>
        public static  int DeleteCompanyModuleById(ModuleInfo MInfo)
        {
            return DbSupplier.GetInstance.DeleteCompanyModuleById(MInfo);
        }
        /// <summary>
        /// 根據模塊名刪除模塊
        /// </summary>
        /// <param name="MInfo"></param>
        /// <returns></returns>
        public static  int DeleteCompanyModuleByName(ModuleInfo MInfo)
        {
            return DbSupplier.GetInstance.DeleteCompanyModuleByName(MInfo);
        }
        /// <summary>
        /// 給角色指定（添加）操作模塊
        /// </summary>
        /// <param name="RMinfo"></param>
        /// <returns></returns>
        public static  int AddNewCompanyRolesModule(RolesModuleInfo RMinfo)
        {
            return DbSupplier.GetInstance.AddNewCompanyRolesModule(RMinfo);
        }
        /// <summary>
        /// 根據主鍵ID刪除角色操作模塊
        /// </summary>
        /// <param name="RMinfo"></param>
        /// <returns></returns>
        public static  int DeleteCompanyRolesModuleById(RolesModuleInfo RMinfo)
        {
            return DbSupplier.GetInstance.DeleteCompanyRolesModuleById(RMinfo);
        }
        /// <summary>
        /// 根據角色ID刪除角色操作模塊
        /// </summary>
        /// <param name="RMinfo"></param>
        /// <returns></returns>
        public static  int DeleteCompanyRolesModuleByRolesId(RolesModuleInfo RMinfo)
        {
            return DbSupplier.GetInstance.DeleteCompanyRolesModuleByRolesId(RMinfo);
        }
        /// <summary>
        /// 根據模塊ID和角色ID刪除角色操作模塊
        /// </summary>
        /// <param name="RMinfo"></param>
        /// <returns></returns>
        public static  int DeleteCompanyRolesModuleByRolesIdAndModuleId(RolesModuleInfo RMinfo)
        {
            return DbSupplier.GetInstance.DeleteCompanyRolesModuleByRolesIdAndModuleId(RMinfo);
        }
        /// <summary>
        /// 取得所有模塊與角色與權限信息
        /// </summary>
        /// <returns></returns>
        public static  DataSet GetCompanyAllRolesModulePermissions()
        {
            return DbSupplier.GetInstance.GetCompanyAllRolesModulePermissions();
        }
        /// <summary>
        /// 取得所有角色信息
        /// </summary>
        /// <returns></returns>
        public static  DataSet GetCompanyAllRolesInfo()
        {
            return DbSupplier.GetInstance.GetCompanyAllRolesInfo();
        }
        /// <summary>
        /// 根據ID刪除角色和所有關聯表數據
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static  int DelCompanyRolesAndInnerTable(string id)
        {
            return DbSupplier.GetInstance.DelCompanyRolesAndInnerTable(id);
        }
    }
}
